Page({
  data: {

  },
  onLoad: function (options) {
    console.log(options.allID)
    this.setData({
      studentID:options.allID
    })
  },
  bindSave:function(e){
    var studentID=this.data.studentID
    var password=e.detail.value.password
    var password1=e.detail.value.password1

    if(password == null) {
      wx.showToast({
        title: '请输入密码！',
        icon: 'none',
        duration: 2000
      })
      return false;
    }else if(password1 == null){
      wx.showToast({
        title: '请确认密码！',
        icon: 'none',
        duration: 2000
      })
      return false;
    }else if(password!=password1){
      wx.showToast({
        title: '两次密码不一致重新输入',
        icon: 'none',
        duration: 2000
      })
      return false;
    }
        wx.cloud.callFunction({
          name:"alterstudentpassword",
          data:{
            studentID: studentID,
            password:password
          }
        }).then(res=>{
          wx.showToast({
            title: '修改成功',
            icon: 'loading',
            mask:true,
            duration: 2000,
            success:function(){
              setTimeout(function () {
                //要延时执行的代码
                wx.navigateTo({
                  url: '/pages/firstV2.0/firstV2.0',
                })
              }, 2000) //延迟时间
            }
          })
        })
      }
})